/*
 * Copyright (c) 2012. The Genome Analysis Centre, Norwich, UK
 * MISO project contacts: Robert Davey, Mario Caccamo @ TGAC
 * *********************************************************************
 *
 * This file is part of MISO.
 *
 * MISO is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * MISO is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MISO.  If not, see <http://www.gnu.org/licenses/>.
 *
 * *********************************************************************
 */

package uk.ac.bbsrc.tgac.miso.core.data.impl;

import com.eaglegenomics.simlims.core.User;
import uk.ac.bbsrc.tgac.miso.core.data.AbstractSampleQC;
import uk.ac.bbsrc.tgac.miso.core.data.Sample;
import uk.ac.bbsrc.tgac.miso.core.exception.MalformedSampleException;

import java.io.Serializable;

/**
 * uk.ac.bbsrc.tgac.miso.core.data.impl
 * <p/>
 * Info
 *
 * @author Rob Davey
 * @since 0.0.2
 */
public class SampleQCImpl extends AbstractSampleQC implements Serializable {
  /**
   * Construct a new SampleQCImpl
   */
  public SampleQCImpl() {

  }

  /**
   * Construct a new SampleQC from a parent Sample, checking that the given User can read that Sample
   *
   * @param sample of type Sample
   * @param user of type User
   */
  public SampleQCImpl(Sample sample, User user) {
    if (sample.userCanRead(user)) {
      try {
        setSample(sample);
      }
      catch (MalformedSampleException e) {
        e.printStackTrace();
      }
      //setSecurityProfile(experiment.getSecurityProfile());
    }
    else {
      //setSecurityProfile(new SecurityProfile(user));
    }
  }

  public boolean userCanRead(User user) {
    return true;
  }

  public boolean userCanWrite(User user) {
    return true;
  }
}
